<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>智慧热力系统管理后台</title>
    <link rel="stylesheet" href="layui/css/layui.css">
</head>
<script src="jquery/jquery-3.5.1.js"></script>
<script src="layui/layui.js"></script>
<script src="js/checkLogin.js">
    $("xingMing").val(yongHuJSON.xingMing);
</script>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo" style="color: #00F7DE; font-size: 20px">智慧热力系统管理后台</div>
        <!-- 头部区域（可配合layui已有的水平导航） -->
        <ul class="layui-nav layui-layout-left">
            <li class="layui-nav-item">
<!--                <a href="">日志管理</a>-->
            </li>
            <li class="layui-nav-item">
                <a href="geRenXinXi.html">用户</a>
            </li>
            <li class="layui-nav-item">
                <a href="javascript:;">其它系统</a>
                <dl class="layui-nav-child">
                    <dd><a href="">邮件管理</a></dd>
                    <dd><a href="">消息管理</a></dd>
                    <dd><a href="">授权管理</a></dd>
                </dl>
            </li>
        </ul>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item">
                <a href="javascript:;">
                    <img src="http://t.cn/RCzsdCq" class="layui-nav-img" id="headImg">
                    <span id="yongHuMing"></span>
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="">基本资料</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item"><a href="login.html">退了</a></li>
        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree"  lay-filter="test">
                <li class="layui-nav-item layui-this">
                    <a class="" href="index.html">首页</a>
                </li>
                <li class="layui-nav-item">
                    <a class="" href="zuZhiJiaGou.html">组织架构</a>
                </li>
                <li class="layui-nav-item layui-nav-itemed">
                    <a class="" href="javascript:">数据管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="jueSeGuanLi.html">角色管理</a></dd>
                        <dd><a href="guanliyuan_chengjiguanli.html">成绩管理</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item layui-nav-itemed">
                    <a class="" href="javascript:">学生管理</a>
                    <dl class="layui-nav-child">
                        <dd ><a href="kaoqinguanli.html">考勤管理</a></dd>
                        <dd ><a href="biyeyujing.html">毕业预警</a></dd>
                        <dd ><a href="xuefenyujing.html">学分预警</a></dd>

                    </dl>
                </li>

            </ul>
        </div>
    </div>

    <div class="layui-body">
        <!-- 内容主体区域 -->
        <div style="padding: 15px;">

            <!-- 面包屑导航 -->
            <span class="layui-breadcrumb">
              <a href="index.html">首页</a>
              <a><cite>个人信息</cite></a>
            </span>

            <!-- 水平线 -->
            <hr class="layui-bg-blue">

            <!-- 个人信息 -->
            <fieldset class="layui-elem-field">
                <legend>个人信息</legend>
                <div class="layui-field-box">
                    <div class="layui-form-item layui-form-pane">
                    </div>

                    <div class="layui-form-item layui-form-pane">
                        <label class="layui-form-label">姓名</label>
                        <div class="layui-input-inline">
                            <input type="text" id="xingMing" placeholder="xingMing" class="layui-input" readonly>
                        </div>
                    </div>

                    <div class="layui-form-item layui-form-pane">
                        <label class="layui-form-label">学号</label>
                        <div class="layui-input-inline">
                            <input type="text" id="xueHao" placeholder="学号" class="layui-input" readonly>
                        </div>
                    </div>

                    <div class="layui-form-item layui-form-pane">
                        <label class="layui-form-label">年级</label>
                        <div class="layui-input-inline">
                            <input type="text" id="nianJi" placeholder="年级" class="layui-input" readonly>
                        </div>
                    </div>
                    <div class="layui-form-item layui-form-pane">
                        <label class="layui-form-label">身份</label>
                        <div class="layui-input-inline">
                            <input type="text" id="shenfen" placeholder="身份" class="layui-input" readonly>
                        </div>
                    </div>

                    <div class="layui-form-item layui-form-pane">
                        <label class="layui-form-label">电话</label>
                        <div class="layui-input-inline">
                            <input type="text" id="dianHua" placeholder="电话" class="layui-input" >
                        </div>
                    </div>
                    <div class="layui-form-item layui-form-pane">
                        <label class="layui-form-label">老密码</label>
                        <div class="layui-input-inline">
                            <input type="password" id="miMa" placeholder="原密码" class="layui-input" >
                        </div>
                    </div>
                    <div class="layui-form-item layui-form-pane">
                        <label class="layui-form-label">新密码</label>
                        <div class="layui-input-inline">
                            <input type="password" id="xmiMa" placeholder="新密码" class="layui-input" >
                        </div>
                    </div>


                </div>
                <button type="button" class="layui-btn" style="margin-top: 5px;background-color: cornflowerblue" id="gengXin">修改</button>
            </fieldset>
        </div>
    </div>

    <div class="layui-footer">
        <!-- 底部固定区域 -->
        四川民惠
    </div>
</div>
<script>
    $("#yongHuMingg").val(yongHuJSON.xingMing);
    $(function () {
        var yongHuJSON = JSON.parse(sessionStorage.getItem("yongHu"));
        $("#xingMing").val(yongHuJSON.xingMing);

        $("#xueHao").val(yongHuJSON.xueHao);

        $("#nianJi").val(yongHuJSON.nianJi);
        $("#dianHua").val(yongHuJSON.dianHua);


        if(yongHuJSON.quanXianId===1){
            $("#shenfen").val("学生")
        }else if(
            yongHuJSON.quanXianId===2
        ){
            $("#shenfen").val("老师");
        }else if(
            yongHuJSON.quanXianId==3
        ){
            $("#shenfen").val("管理");
        }
    });
    //JavaScript代码区域
    layui.use('element', function(){
        var element = layui.element;

    });
       $("#gengXin").click(function () {

           var  dianHua=$("#dianHua").val();
           var  miMa=$("#miMa").val()+","+$("#xmiMa").val();


        $.ajax({   // 异步请求   想象成线程状态
            url:"/xueSheng/xiuGai",   // 请求路径
            type:"post",               // 请求的方式，不区分大小写   传递json不能使用get请求，否则返回400错误
            contentType:"application/json;charset=utf-8",
            datatype:"text",
            // request中传递的key-value值
            data:JSON.stringify({
              dianHua:dianHua,
                miMa:miMa,
                id:yongHuJSON.id
            }),
            success:function(response){                        // 后台服务响应成功，自动返回数据
                if(response.code === 200) {
                    alert("修改成功!");
                    layer.close(index);   // 关闭当前对话框
                    alert("修改成功!");
                    search();
                }
                else if(response.code===250){
                    alert("原密码错误，请稍后重试!");
                }
            },
            error:function(response){             // 网络请求失败，自动调用此方法
                console.log("出错" + response);
                layer.close(index);   // 关闭当前对话框
            }
        });
    })
</script>
</body>
</html>
